<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<spring:url value="/resources" var="resUrl" />
<spring:url value="/admin" var="adminUrl" />
<spring:url value="/admin/sites/${site.id}" var="ourSiteUrl" />
<link rel="stylesheet" href="${resUrl}/common.css" type="text/css"></link>

<title>Hosts</title>
</head>
<body>

	<h1>Hosts for the site ${site.name}</h1>

	<c:set var="hasHosts" value="${not empty hosts}" />
	<c:if test="${hasHosts}">
		<div class="listing">
			<table>
				<tr>
					<th>Hostname</th>
					<th>Status</th>
				</tr>
				<c:forEach items="${hosts}" var="h">
					<tr>
						<td><a href="${adminUrl}/hosts/${h.id}">${h.hostname}</a></td>
						<td><div>
								${h.connectionStatus}
								<c:if test="${not empty h.statusMessage}">
							, ${h.statusMessage}
							</c:if>
							</div>
							<div>
								<a href="${ourSiteUrl}/checkHost/${h.id}">Re-check</a>
							</div></td>
					</tr>
				</c:forEach>
			</table>
		</div>
	</c:if>
	<c:if test="${not hasHosts}">
		No hosts yet
	</c:if>

	<div>
		<a href="${ourSiteUrl}/addHost">Add Host</a>
	</div>
</body>
</html>
